Skip to content

Conversation

@marliessophie
Copy link
Member

@marliessophie marliessophie commented Nov 26, 2025

Important

Add methods to Langfuse client for fetching, listing, and deleting dataset runs, with tests for folder-format names, but fix URL encoding issues.

  • Methods Added:
    • get_dataset_run: Fetches a single dataset run by dataset name and run name in client.py.
    • get_dataset_runs: Retrieves a paginated list of runs for a dataset in client.py.
    • delete_dataset_run: Permanently deletes a dataset run and all its items in client.py.
  • Imports:
    • Added DatasetRunWithItems, DeleteDatasetRunResponse, and PaginatedDatasetRuns types in client.py.
  • Issues:
    • Missing is_url_param=True flag in _url_encode() calls for path parameters in all three methods, potentially causing double-encoding issues.
  • Tests:
    • Added tests for get_dataset_run, get_dataset_runs, and delete_dataset_run with folder-format names in test_datasets.py.

This description was created by Ellipsis for 617b4e7. You can customize this summary. It will automatically update as commits are pushed.


Disclaimer: Experimental PR review

Greptile Overview

Greptile Summary

Added three new methods to the Langfuse client for managing dataset runs: get_dataset_run, get_dataset_runs, and delete_dataset_run.

  • get_dataset_run: fetches a single dataset run by dataset name and run name
  • get_dataset_runs: retrieves paginated list of runs for a dataset
  • delete_dataset_run: permanently deletes a dataset run and all its items
  • Added required import statements for DatasetRunWithItems, DeleteDatasetRunResponse, and PaginatedDatasetRuns types

Issues found:

  • Missing is_url_param=True flag in _url_encode() calls for path parameters across all three methods. These parameters are embedded in URL paths and passed to httpx, which handles encoding automatically in v0.28+. This inconsistency with the existing get_dataset method (line 2445) could cause double-encoding issues.

Confidence Score: 3/5

  • This PR can be merged after addressing the URL encoding parameter issue.
  • The implementation follows existing patterns and adds straightforward CRUD operations for dataset runs. However, the missing is_url_param=True flags could cause encoding issues with special characters in dataset/run names. The fix is simple but critical for correctness.
  • Fix the _url_encode() calls in langfuse/_client/client.py to include is_url_param=True for all path parameters

Important Files Changed

File Analysis

Filename Score Overview
langfuse/_client/client.py 3/5 added three dataset run methods (get_dataset_run, get_dataset_runs, delete_dataset_run); missing is_url_param=True flag in URL encoding calls for path parameters

Sequence Diagram

sequenceDiagram
    participant User
    participant Langfuse
    participant API as Langfuse API
    
    Note over User,API: Get Dataset Run
    User->>Langfuse: get_dataset_run(dataset_name, run_name)
    Langfuse->>Langfuse: _url_encode(dataset_name)
    Langfuse->>Langfuse: _url_encode(run_name)
    Langfuse->>API: datasets.get_run(dataset_name, run_name)
    API-->>Langfuse: DatasetRunWithItems
    Langfuse-->>User: DatasetRunWithItems
    
    Note over User,API: Get Dataset Runs (Paginated)
    User->>Langfuse: get_dataset_runs(dataset_name, page, limit)
    Langfuse->>Langfuse: _url_encode(dataset_name)
    Langfuse->>API: datasets.get_runs(dataset_name, page, limit)
    API-->>Langfuse: PaginatedDatasetRuns
    Langfuse-->>User: PaginatedDatasetRuns
    
    Note over User,API: Delete Dataset Run
    User->>Langfuse: delete_dataset_run(dataset_name, run_name)
    Langfuse->>Langfuse: _url_encode(dataset_name)
    Langfuse->>Langfuse: _url_encode(run_name)
    Langfuse->>API: datasets.delete_run(dataset_name, run_name)
    API-->>Langfuse: DeleteDatasetRunResponse
    Langfuse-->>User: DeleteDatasetRunResponse
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@hassiebp hassiebp enabled auto-merge (squash) January 12, 2026 10:45
@s1st
Copy link

s1st commented Jan 12, 2026

Hi! I recently opened PR #1496 which was closed as a duplicate of this one. I noticed this PR has been waiting for updates since November.

I'd be happy to help move this forward - I can submit the requested changes (keyword arguments + tests for URL encoding) either as commits to this branch or as a separate PR if that's easier.

Let me know if there's anything I can do to help get this merged!

@hassiebp hassiebp merged commit ea5658f into main Jan 13, 2026
12 checks passed
@hassiebp hassiebp deleted the marlies/lfe-dataset-fetch-consistencies branch January 13, 2026 09:32
Copy link
Contributor

Hi Simon - thank you! This change has been released in our latest Python SDK version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants